package com.BraveY.Demo08;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Demo02 {
    public static void main(String[] args) throws ParseException {
        Date date1 = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH：mm：SS");
        String s= sdf.format(date1);
        System.out.println(s);

        String ss = "2048-08-09 11:11:11";
        //ParseException
        SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date dd = sdf2.parse(ss);
        System.out.println(dd);

        Date d1 = new Date();
        SimpleDateFormat s1 = new SimpleDateFormat("yyyy年MM月dd日 HH：mm：SS");
        String s2 = s1.format(d1);
        System.out.println(s2);

        String d2 = "2048-08-09 11:05:11";
        SimpleDateFormat s3 = new SimpleDateFormat("yyyy-MM-dd HH:mm:SS");
        Date s4 = s3.parse(d2);
        System.out.println(s4);

    }
}
